import { getLevelZeroJson } from '@/utils';
import { ProcdefManageAPI } from '../common/type';
import { filterTree, handleDutySearchList } from '../../DesignManage/common/common';

/** 流程设计搜索 */
const getSearchColumns = (): ProcdefManageAPI.IHeaderSearchType => {
  let orgDeptList: any[] = getLevelZeroJson();
  /** 处理组织机构数据 */
  const dutyIdList = handleDutySearchList(filterTree(orgDeptList), 'text', 'id');
  return [
    {
      name: 'ownCompanyID',
      placeholder: '所属单位',
      label: '所属单位',
      componentType: 'TreeSelect',
      dataSource: dutyIdList,
      treeNodeFilterProp: 'name',
      allowClear: true,
      md: 5,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'deptFlag',
      placeholder: '是否科研机构',
      label: '是否科研机构',
      componentType: 'Select',
      dataSource: [
        {
          name: '是',
          value: '1',
        },
        {
          name: '否',
          value: '0',
        },
      ],
      allowClear: true,
      md: 5,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'name',
      label: '流程名称',
      placeholder: '流程名称',
      componentType: 'Input',
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'description',
      placeholder: '描述',
      label: '描述',
      componentType: 'Input',
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'suspendState',
      placeholder: '激活状态',
      label: '激活状态',
      componentType: 'Select',
      dataSource: [
        {
          name: '激活',
          value: '1',
        },
        {
          name: '挂起',
          value: '0',
        },
      ],
      allowClear: true,
      md: 5,
      sm: 24,
      whetherSenior: false,
    },
  ];
};

export { getSearchColumns };
